package handler

import (
	"fmt"
	"net/http"
	"info"
	"login"
	"dbkey"
)

func init() {
	http.HandleFunc("/info", info.Show)
	http.HandleFunc("/login", login.Do)
	http.HandleFunc("/debug", debug)
	http.HandleFunc("/api/dbkey", dbkey.Do)
}

func debug(w http.ResponseWriter, r *http.Request) {
	pass, reason := login.Check(r)
	if pass {
		fmt.Fprint(w, "Pass")
	} else {
		fmt.Fprint(w, "Fail, possible reason: ", reason)
	}
}
